package org.hgvc.webapp.ets.spring.service;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;

import org.hgvc.webapp.ets.bo.Agent;
import org.hgvc.webapp.ets.bo.Agreement;
import org.hgvc.webapp.ets.bo.RCIAssignment;
import org.hgvc.webapp.ets.bo.RCIAssignmentDetail;
import org.hgvc.webapp.ets.bo.RCIBulkBank;
import org.hgvc.webapp.ets.bo.RCIMember;
import org.hgvc.webapp.ets.bo.Voucher;
import org.hgvc.webapp.ets.constant.AgreementConstant;
import org.hgvc.webapp.ets.jsf.beans.ReportBean;
import org.hgvc.webapp.ets.jsf.beans.report.AgtReportInfoBean;
import org.hgvc.webapp.ets.jsf.beans.report.RciReportInfoBean;
import org.hgvc.webapp.ets.jsf.beans.report.ReportSearchBean;
import org.hgvc.webapp.ets.jsf.beans.report.VoucerReportInfoBean;
import org.hgvc.webapp.ets.spring.dao.ReportHbmDao;
import org.jocsb.base.exception.BaseException;
import org.jocsb.base.util.FacesUtils;
import org.jocsb.base.util.SpringUtils;


public class ReportServiceImpl implements ReportService {
	
	private ReportHbmDao dao;
	private SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");

	public ReportHbmDao getDao() {
		return dao;
	}

	public void setDao(ReportHbmDao dao) {
		this.dao = dao;
	}

	public void createAgtListByStatusReport(ReportSearchBean searchBean) throws BaseException {
		List<Agreement> agreementList = new ArrayList<Agreement>();
		List<AgtReportInfoBean> infoList = new ArrayList<AgtReportInfoBean>();
		try {
			agreementList = dao.getAgreementList(searchBean);	
			for(Agreement temp : agreementList){
				AgtReportInfoBean infoBean = new AgtReportInfoBean();
				infoBean.setAgtNo(temp.getAgreetmentNo());
				if(temp.getAgreetmentDate()!=null)
					infoBean.setAgtDate(dateFormat.format(temp.getAgreetmentDate()));
				else
					infoBean.setAgtDate("");
				infoBean.setMbrNo(temp.getMember().getMembershipNo());
				infoBean.setMbrName(temp.getMember().getName());
				if(temp.getBranch()!=null)
					infoBean.setBranch(temp.getBranch().getCode());
				else
					infoBean.setBranch("");
				infoBean.setAcNo(temp.getCertificateNo());
				if(temp.getStatus()!=null){
					if(temp.getStatus().equalsIgnoreCase(AgreementConstant.AGREEMENT_STATUS_PENDING))
						infoBean.setStatus(SpringUtils.getMessage("agreement.status.pending", new Object[]{}));
					else if(temp.getStatus().equalsIgnoreCase(AgreementConstant.AGREEMENT_STATUS_SUSPEND))
						infoBean.setStatus(SpringUtils.getMessage("agreement.status.suspend", new Object[]{}));
					else
						infoBean.setStatus(SpringUtils.getMessage("agreement.status.active", new Object[]{}));	
				}else
					infoBean.setStatus(SpringUtils.getMessage("agreement.status.unknown", new Object[]{}));	
				infoList.add(infoBean);
			}
			HashMap params = new HashMap();
			if(searchBean.getStartDate()!=null && searchBean.getEndDate()!=null)
				params.put("title", "Agreement List by Status From Date " + dateFormat.format(searchBean.getStartDate()) + " to " + dateFormat.format(searchBean.getEndDate()));
			else if(searchBean.getStartDate()!=null && searchBean.getEndDate()==null){
				params.put("title", "Agreement List by Status From Date " + dateFormat.format(searchBean.getStartDate()));
			}else if(searchBean.getStartDate()==null && searchBean.getEndDate()!=null){
				params.put("title", "Agreement List by Status to " + dateFormat.format(searchBean.getEndDate()));
			}else{
				params.put("title", "Agreement List by Status");
			}
			//params.put("logoPath", "F:\\workspace\\ets-v2\\web\\image\\logo_backup.gif");
			ReportBean reportBean = new ReportBean();
			reportBean.createReportJasper(params, infoList, "agt_list_by_status");
		} catch (Exception ex) {
			ex.printStackTrace();
			throw new BaseException(SpringUtils.getMessage("error.list.agreement", new Object[]{}));
		}
	}
	
	public void createAgtListWithAddressReport(ReportSearchBean searchBean) throws BaseException {
		String reportPath = FacesUtils.getServletContext().getRealPath("WEB-INF"+File.separator+"reports");	
		List<Agreement> agreementList = new ArrayList<Agreement>();
		List<AgtReportInfoBean> infoList = new ArrayList<AgtReportInfoBean>();
		HashMap<String, AgtReportInfoBean> groupByMemberHm = new HashMap<String, AgtReportInfoBean>();
		try {
			agreementList = dao.getAgreementList(searchBean);	
			for(Agreement temp : agreementList){
				String mbrNo = temp.getMember().getMembershipNo();
				if(groupByMemberHm.containsKey(mbrNo)){
					// Info Bean
					AgtReportInfoBean infoBean = groupByMemberHm.get(mbrNo);
					List<AgtReportInfoBean> list = infoBean.getGroupByMemberList();
					// Inner Info Bean
					AgtReportInfoBean innerInfoBean = new AgtReportInfoBean();
					innerInfoBean.setAgtNo(temp.getAgreetmentNo());
					if(temp.getAgreetmentDate()!=null)
						innerInfoBean.setAgtDate(dateFormat.format(temp.getAgreetmentDate()));
					else
						innerInfoBean.setAgtDate("");
					innerInfoBean.setIcNo(temp.getMember().getMemberRegNo());
					Agent agent = temp.getMember().getAgent();
					StringBuffer addressBfr = new StringBuffer();
					if(agent!=null){
						addressBfr.append(agent.getMailAddress1());
						addressBfr.append(agent.getMailAddress2());
						addressBfr.append(agent.getMailPostcode());
						addressBfr.append(agent.getMailCity());
						addressBfr.append(agent.getMailState());
						addressBfr.append(agent.getMailCountry());
					}
					innerInfoBean.setAddress(addressBfr.toString());
					innerInfoBean.setType(temp.getMembership().getName());
					innerInfoBean.setPrice(temp.getMembership().getMembershipFee());
					list.add(innerInfoBean);
					infoBean.setDataSource(new JRBeanCollectionDataSource(list));
					infoBean.setGroupByMemberList(list);
				}else{
					// Info Bean
					AgtReportInfoBean infoBean = new AgtReportInfoBean();
					infoBean.setMbrNo(temp.getMember().getMembershipNo());
					infoBean.setMbrName(temp.getMember().getName());
					List<AgtReportInfoBean> list = new ArrayList<AgtReportInfoBean>();
					// Inner Info Bean
					AgtReportInfoBean innerInfoBean = new AgtReportInfoBean();
					innerInfoBean.setAgtNo(temp.getAgreetmentNo());
					if(temp.getAgreetmentDate()!=null)
						innerInfoBean.setAgtDate(dateFormat.format(temp.getAgreetmentDate()));
					else
						innerInfoBean.setAgtDate("");
					innerInfoBean.setIcNo(temp.getMember().getMemberRegNo());
					Agent agent = temp.getMember().getAgent();
					StringBuffer addressBfr = new StringBuffer();
					if(agent!=null){
						addressBfr.append(agent.getMailAddress1());
						addressBfr.append(agent.getMailAddress2());
						addressBfr.append(agent.getMailPostcode());
						addressBfr.append(agent.getMailCity());
						addressBfr.append(agent.getMailState());
						addressBfr.append(agent.getMailCountry());
					}
					innerInfoBean.setAddress(addressBfr.toString());
					innerInfoBean.setType(temp.getMembership().getName());
					innerInfoBean.setPrice(temp.getMembership().getMembershipFee());
					list.add(innerInfoBean);
					infoBean.setDataSource(new JRBeanCollectionDataSource(list));
					infoBean.setGroupByMemberList(list);
					groupByMemberHm.put(mbrNo, infoBean);
				}
			}
			infoList = new ArrayList<AgtReportInfoBean>(groupByMemberHm.values());
			HashMap params = new HashMap();
			if(searchBean.getStartDate()!=null && searchBean.getEndDate()!=null)
				params.put("title", "Agreement List with Addresses From Date " + dateFormat.format(searchBean.getStartDate()) + " to " + dateFormat.format(searchBean.getEndDate()));
			else if(searchBean.getStartDate()!=null && searchBean.getEndDate()==null){
				params.put("title", "Agreement List with Addresses From Date " + dateFormat.format(searchBean.getStartDate()));
			}else if(searchBean.getStartDate()==null && searchBean.getEndDate()!=null){
				params.put("title", "Agreement List with Addresses to " + dateFormat.format(searchBean.getEndDate()));
			}else{
				params.put("title", "Agreement List with Addresses");
			}
			//params.put("logoPath", "F:\\workspace\\ets-v2\\web\\image\\logo_backup.gif");
			params.put("subReportPath", reportPath + File.separator + "agt_list_with_address_subList.jasper");
			ReportBean reportBean = new ReportBean();
			reportBean.createReportJasper(params, infoList, "agt_list_with_address");
		} catch (Exception ex) {
			ex.printStackTrace();
			throw new BaseException(SpringUtils.getMessage("error.list.agreement", new Object[]{}));
		}
	}

	public void createCompVoucherIssueReport(ReportSearchBean searchBean)
			throws BaseException {
		List<Voucher> voucherList = new ArrayList<Voucher>();
		List<VoucerReportInfoBean> infoList = new ArrayList<VoucerReportInfoBean>();
		try {
			voucherList = dao.getVoucherList(searchBean);
			for(Voucher temp : voucherList){
				VoucerReportInfoBean voucherInfoBean = new VoucerReportInfoBean();
				voucherInfoBean.setVoucherNo(temp.getVoucherNo());
				voucherInfoBean.setVoucherDate(dateFormat.format(temp.getEffectiveDate()));
				voucherInfoBean.setExpireDate(dateFormat.format(temp.getExpiryDate()));
				voucherInfoBean.setNoOfNight(temp.getNoOfNights());
				voucherInfoBean.setNoOfPerson(temp.getNoOfPerson());
				if(temp.getAssignToAgent()!=null)
					voucherInfoBean.setName(temp.getAssignToAgent().getRefUser().getUsername());
				else if(temp.getAssignToHgvcUser()!=null)
					voucherInfoBean.setName(temp.getAssignToHgvcUser().getUsername());
				if(temp.getProduct1()!=null){
					VoucerReportInfoBean infoBean = new VoucerReportInfoBean(voucherInfoBean);
					infoBean.setResort(temp.getProduct1().getName());
					infoList.add(infoBean);
				}else if(temp.getProduct2()!=null){
					VoucerReportInfoBean infoBean = new VoucerReportInfoBean(voucherInfoBean);
					infoBean.setResort(temp.getProduct2().getName());
					infoList.add(infoBean);
				}else if(temp.getProduct3()!=null){
					VoucerReportInfoBean infoBean = new VoucerReportInfoBean(voucherInfoBean);
					infoBean.setResort(temp.getProduct3().getName());
					infoList.add(infoBean);
				}else if(temp.getProduct4()!=null){
					VoucerReportInfoBean infoBean = new VoucerReportInfoBean(voucherInfoBean);
					infoBean.setResort(temp.getProduct4().getName());
					infoList.add(infoBean);
				}else if(temp.getProduct5()!=null){
					VoucerReportInfoBean infoBean = new VoucerReportInfoBean(voucherInfoBean);
					infoBean.setResort(temp.getProduct5().getName());
					infoList.add(infoBean);
				}
			}
			HashMap params = new HashMap();
//			if(searchBean.getStartDate()==null){
//				params.put("title", "Voucher ");
//			}else if(searchBean.getOperator().equalsIgnoreCase(ReportSearchBean.le)){
//				params.put("title", "Voucher Less Than Date " + dateFormat.format(searchBean.getStartDate()));
//			}else if(searchBean.getOperator().equalsIgnoreCase(ReportSearchBean.le)){
//				params.put("title", "Voucher Less Or Equal Than Date " + dateFormat.format(searchBean.getStartDate()));
//			}else if(searchBean.getOperator().equalsIgnoreCase(ReportSearchBean.le)){
//				params.put("title", "Voucher Greater Than Date " + dateFormat.format(searchBean.getStartDate()));
//			}else if(searchBean.getOperator().equalsIgnoreCase(ReportSearchBean.le)){
//				params.put("title", "Voucher Greater Or Equal Than Date " + dateFormat.format(searchBean.getStartDate()));
//			}else{
//				params.put("title", "Voucher Equal Date " + dateFormat.format(searchBean.getStartDate()));
//			}
			params.put("title", "Complimentary Voucher Issued");
			//params.put("logoPath", "F:\\workspace\\ets-v2\\web\\image\\logo_backup.gif");
			ReportBean reportBean = new ReportBean();
			reportBean.createReportJasper(params, infoList, "comp_voucher_issue");
		} catch (Exception ex) {
			ex.printStackTrace();
			throw new BaseException(SpringUtils.getMessage("error.list.voucher", new Object[]{}));
		}
		
	}

	public void createSalesReportByBranchReport(ReportSearchBean searchBean)
			throws BaseException {	
		String reportPath = FacesUtils.getServletContext().getRealPath("WEB-INF"+File.separator+"reports");	
		List<Agreement> agreementList = new ArrayList<Agreement>();
		List<AgtReportInfoBean> infoList = new ArrayList<AgtReportInfoBean>();
		HashMap<String, AgtReportInfoBean> groupByBranchHm = new HashMap<String, AgtReportInfoBean>();
		try {
			agreementList = dao.getAgreementList(searchBean);	
			for(Agreement temp : agreementList){
				//String branch = temp.getBranch().getCode();
				String branch = "Puchong";
				if(groupByBranchHm.containsKey(branch)){
					// Info Bean
					AgtReportInfoBean infoBean = groupByBranchHm.get(branch);
					List<AgtReportInfoBean> list = infoBean.getGroupByMemberList();
					// Inner Info Bean
					AgtReportInfoBean innerInfoBean = new AgtReportInfoBean();
					innerInfoBean.setDeposit(dao.getDeposit(temp));
					innerInfoBean.setMbrNo(temp.getMember().getMembershipNo());
					innerInfoBean.setMbrName(temp.getMember().getName());
					innerInfoBean.setAgtNo(temp.getAgreetmentNo());
					innerInfoBean.setVcName(temp.getVacationCounselor());
					if(temp.getAgreetmentDate()!=null)
						innerInfoBean.setAgtDate(dateFormat.format(temp.getAgreetmentDate()));
					else
						innerInfoBean.setAgtDate("");
					innerInfoBean.setIcNo(temp.getMember().getMemberRegNo());
					Agent agent = temp.getMember().getAgent();
					StringBuffer addressBfr = new StringBuffer();
					if(agent!=null){
						addressBfr.append(agent.getMailAddress1());
						addressBfr.append(agent.getMailAddress2());
						addressBfr.append(agent.getMailPostcode());
						addressBfr.append(agent.getMailCity());
						addressBfr.append(agent.getMailState());
						addressBfr.append(agent.getMailCountry());
					}
					innerInfoBean.setAddress(addressBfr.toString());
					innerInfoBean.setType(temp.getMembership().getName());
					innerInfoBean.setPrice(temp.getMembership().getMembershipFee());
					list.add(innerInfoBean);
					infoBean.setDataSource(new JRBeanCollectionDataSource(list));
					infoBean.setGroupByMemberList(list);
				}else{
					// Info Bean
					AgtReportInfoBean infoBean = new AgtReportInfoBean();
					infoBean.setBranch(branch);
					List<AgtReportInfoBean> list = new ArrayList<AgtReportInfoBean>();
					// Inner Info Bean
					AgtReportInfoBean innerInfoBean = new AgtReportInfoBean();
					innerInfoBean.setMbrNo(temp.getMember().getMembershipNo());
					innerInfoBean.setDeposit(dao.getDeposit(temp));
					innerInfoBean.setMbrName(temp.getMember().getName());
					innerInfoBean.setAgtNo(temp.getAgreetmentNo());
					innerInfoBean.setVcName(temp.getVacationCounselor());
					if(temp.getAgreetmentDate()!=null)
						innerInfoBean.setAgtDate(dateFormat.format(temp.getAgreetmentDate()));
					else
						innerInfoBean.setAgtDate("");
					innerInfoBean.setIcNo(temp.getMember().getMemberRegNo());
					Agent agent = temp.getMember().getAgent();
					StringBuffer addressBfr = new StringBuffer();
					if(agent!=null){
						addressBfr.append(agent.getMailAddress1());
						addressBfr.append(agent.getMailAddress2());
						addressBfr.append(agent.getMailPostcode());
						addressBfr.append(agent.getMailCity());
						addressBfr.append(agent.getMailState());
						addressBfr.append(agent.getMailCountry());
					}
					innerInfoBean.setAddress(addressBfr.toString());
					innerInfoBean.setType(temp.getMembership().getName());
					innerInfoBean.setPrice(temp.getMembership().getMembershipFee());
					list.add(innerInfoBean);
					infoBean.setDataSource(new JRBeanCollectionDataSource(list));
					infoBean.setGroupByMemberList(list);
					groupByBranchHm.put(branch, infoBean);
				}
			}
			infoList = new ArrayList<AgtReportInfoBean>(groupByBranchHm.values());
			Integer counter = 0;
			for(AgtReportInfoBean temp : infoList){
				for(AgtReportInfoBean innerTemp: temp.getGroupByMemberList()){
					innerTemp.setIndex(++counter);
				}
				
			}
			HashMap params = new HashMap();
//			if(searchBean.getStartDate()!=null && searchBean.getEndDate()!=null)
//				params.put("title", "Sales Report From Date " + dateFormat.format(searchBean.getStartDate()) + " to " + dateFormat.format(searchBean.getEndDate()));
//			else if(searchBean.getStartDate()!=null && searchBean.getEndDate()==null){
//				params.put("title", "Sales Report From Date " + dateFormat.format(searchBean.getStartDate()));
//			}else if(searchBean.getStartDate()==null && searchBean.getEndDate()!=null){
//				params.put("title", "Sales Report to " + dateFormat.format(searchBean.getEndDate()));
//			}else{
//				params.put("title", "Sales Report");
//			}
			params.put("title", "Sales Report By Branch");
			//params.put("logoPath", "F:\\workspace\\ets-v2\\web\\image\\logo_backup.gif");
			params.put("subReportPath", reportPath + File.separator + "sales_report_by_branch_subList.jasper");
			ReportBean reportBean = new ReportBean();
			reportBean.createReportJasper(params, infoList, "sales_report_by_branch");
		}catch (Exception ex) {
			ex.printStackTrace();
			throw new BaseException(SpringUtils.getMessage("error.list.agreement", new Object[]{}));
		}
	}
	
	public void createRciEnrolMentListReport(ReportSearchBean searchBean)
			throws BaseException {
		List<RCIMember> rciMemberList = new ArrayList<RCIMember>();
		List<RciReportInfoBean> infoList = new ArrayList<RciReportInfoBean>();
		try {
			rciMemberList = dao.getRciMemberList(searchBean, false);
			for(RCIMember temp : rciMemberList){
				RciReportInfoBean infoBean = new RciReportInfoBean();
				infoBean.setRciNo(temp.getRciNo());
				infoBean.setRciMemberName(temp.getRciMemberName());
				infoBean.setEnrolAmount(temp.getEnrollmentAmount());
				if(temp.getEnrollmentDate()!=null)
					infoBean.setEnrolDate(dateFormat.format(temp.getEnrollmentDate()));
				if(temp.getEffectiveDate()!=null)
					infoBean.setEffectiveDate(dateFormat.format(temp.getEffectiveDate()));
				if(temp.getExpiryDate()!=null)
					infoBean.setExpireDate(dateFormat.format(temp.getExpiryDate()));
				infoList.add(infoBean);
			}
			HashMap params = new HashMap();
			params.put("title", "Member RCI Enrolment List");
			//params.put("logoPath", "F:\\workspace\\ets-v2\\web\\image\\logo_backup.gif");
			ReportBean reportBean = new ReportBean();
			reportBean.createReportJasper(params, infoList, "rci_enrol_list");
		} catch (Exception ex) {
			ex.printStackTrace();
			throw new BaseException(SpringUtils.getMessage("error.list.objectt", new Object[]{RCIMember.class.getSimpleName()}));
		}
	}
	
	public void createRciCheckReport(ReportSearchBean searchBean) throws BaseException {
		List<RCIMember> rciMemberList = new ArrayList<RCIMember>();
		List<RciReportInfoBean> infoList = new ArrayList<RciReportInfoBean>();
		try {
			rciMemberList = dao.getRciMemberList(searchBean, false);
			for(RCIMember temp : rciMemberList){
				RciReportInfoBean infoBean = new RciReportInfoBean();
				infoBean.setRciNo(temp.getRciNo());
				infoBean.setRciMemberName(temp.getRciMemberName());
				infoBean.setEnrolAmount(temp.getEnrollmentAmount());
				if(temp.getAgreement()!=null){
					if(temp.getAgreement().getAgreetmentDate()!=null)
						infoBean.setAgtDate(dateFormat.format(temp.getAgreement().getAgreetmentDate()));
					if(temp.getAgreement().getBranch()!=null)
						infoBean.setBranch(temp.getAgreement().getBranch().getCode());
					infoBean.setAgtNo(temp.getAgreement().getAgreetmentNo());
				}
				infoBean.setMbrNo(temp.getRciMemberId());
				
				if(temp.getEnrollmentDate()!=null)
					infoBean.setEnrolDate(dateFormat.format(temp.getEnrollmentDate()));
				if(temp.getEffectiveDate()!=null)
					infoBean.setEffectiveDate(dateFormat.format(temp.getEffectiveDate()));
				if(temp.getExpiryDate()!=null)
					infoBean.setExpireDate(dateFormat.format(temp.getExpiryDate()));
				infoList.add(infoBean);
			}
			HashMap params = new HashMap();
			params.put("title", "RCI Check Report");
			//params.put("logoPath", "F:\\workspace\\ets-v2\\web\\image\\logo_backup.gif");
			ReportBean reportBean = new ReportBean();
			reportBean.createReportJasper(params, infoList, "rci_check_report");
		} catch (Exception ex) {
			ex.printStackTrace();
			throw new BaseException(SpringUtils.getMessage("error.list.object", new Object[]{RCIMember.class.getSimpleName()}));
		}
	
	}

	public void createRciSpaceBankDepositReport(ReportSearchBean searchBean)
			throws BaseException {
		List<RCIAssignmentDetail> rciAssignmentList = new ArrayList<RCIAssignmentDetail>();
		List<RciReportInfoBean> infoList = new ArrayList<RciReportInfoBean>();
		try {
			rciAssignmentList = dao.getRciAssignmentList(searchBean);
			for(RCIAssignmentDetail temp : rciAssignmentList){
				RCIAssignment assignment = temp.getRciAssignment();
				RCIMember rciMember = assignment.getRciMember();
				Agreement agreement = rciMember.getAgreement();
				RCIBulkBank bulkBank = temp.getRciBulkBank();
				RciReportInfoBean infoBean = new RciReportInfoBean();
				infoBean.setMbrNo(temp.getRciAssignment().getRciMember().getRciMemberId());
				if(assignment!=null){
					infoBean.setAgtNo(assignment.getRciAssignmentNo());
				}
				if(rciMember!=null){
					infoBean.setMbrNo(rciMember.getRciMemberId());
				}
				if(agreement!=null){	
					infoBean.setAgtNo(agreement.getAgreetmentNo());
				}
				if(bulkBank!=null){
					infoBean.setRoom1(bulkBank.getRoom1No());
					infoBean.setRoom2(bulkBank.getRoom2No());
					infoBean.setYear(bulkBank.getYear());
					infoBean.setWeek(bulkBank.getWeek());
					if(bulkBank.getPartnerProduct()!=null)
						infoBean.setResortId(bulkBank.getPartnerProduct().getName());
					if(bulkBank.getEffectiveDate()!=null)
						infoBean.setEffectiveDate(dateFormat.format(bulkBank.getEffectiveDate()));
				}
				infoList.add(infoBean);
			}
			HashMap params = new HashMap();
			params.put("title", "RCI Space Bank Deposit");
			//params.put("logoPath", "F:\\workspace\\ets-v2\\web\\image\\logo_backup.gif");
			ReportBean reportBean = new ReportBean();
			reportBean.createReportJasper(params, infoList, "rci_space_bank_deposit");
		} catch (Exception ex) {
			ex.printStackTrace();
			throw new BaseException(SpringUtils.getMessage("error.list.object", new Object[]{RCIMember.class.getSimpleName()}));
		}
		
	}

}
